<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>delayk</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="delay1.html" title="delay1" />
    <link rel="next" href="delayr.html" title="delayr" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">delayk</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="delay1.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="delayr.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="delayk"></a>
      <div class="titlepage"></div>
      <a id="IndexDelayk" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">delayk</span>
        </h2>
        <p>delayk — 
      Delays an input signal by some time interval.
          </p>
      </div>
      <div class="refsect1">
        <a id="idp98200832"></a>
        <h2>Description</h2>
        <p>
      k-rate delay opcodes
   </p>
      </div>
      <div class="refsect1">
        <a id="idp98266544"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">kr <span class="command"><strong>delayk </strong></span>  ksig, idel[, imode]</pre>
        <pre class="synopsis">kr <span class="command"><strong>vdel_k </strong></span>  ksig, kdel, imdel[, imode]</pre>
      </div>
      <div class="refsect1">
        <a id="idp98270128"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>idel</em></span> -- delay time (in seconds) for
    delayk. It is rounded to the nearest integer multiple of a k-cycle
    (i.e. 1/kr). 
    </p>
        <p>
      <span class="emphasis"><em>imode</em></span> -- sum of 1 for skipping initialization
      (e.g. in tied notes) and 2 for holding the first input value during the
      initial delay, instead of outputting zero. This is mainly of use
      when delaying envelopes that do not start at zero.
    </p>
        <p>
      </p>
        <div class="mediaobject">
          <img src="images/delayk.png" />
        </div>
        <p>
    </p>
        <p>
      <span class="emphasis"><em>imdel</em></span> -- maximum delay time for vdel_k, in seconds.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp98275728"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>kr</em></span> -- the output signal. Note: neither of the
    opcodes interpolate the output.
        </p>
        <p>
      <span class="emphasis"><em>ksig</em></span> -- the input signal.
        </p>
        <p>
      <span class="emphasis"><em>kdel</em></span> -- delay time (in seconds) for
   vdel_k. It is rounded to the nearest integer multiple of a k-cycle
   (i.e. 1/kr).
    </p>
      </div>
      <div class="refsect1">
        <a id="idp98279200"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the delayk opcode. It uses the file <a class="ulink" href="examples/delayk.csd" target="_top"><em class="citetitle">delayk.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp98281056"></a>
          <p class="title">
            <strong>Example 177. Example of the delayk opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-odac     <span class="comment">;;;RT audio out</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if RT audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o delayk.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>
<span class="comment">;example shows "delayk" for fm index and </span>
<span class="comment">;a second "delayk" for panning</span>
<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">ksmps</span> <span class="op">=</span> 32
<span class="ohdr">nchnls</span> <span class="op">=</span> 2
<span class="ohdr">0dbfs</span> <span class="op">=</span> 1

gisin <span class="ohdr">ftgen</span> 0, 0, 2^10, 10, 1

<span class="oblock">instr</span> 1

kenv1 <span class="opc">transeg</span> 0, .02, 0, 1, 3.98, <span class="op">-</span>6, 0 <span class="comment">;envelope</span>
kenv2 <span class="opc">delayk</span> kenv1, 2			<span class="comment">;delayed by two seconds</span>
kindx <span class="opc">expon</span> 5, p3, 1			<span class="comment">;fm index decreasing over p3</span>
asig  <span class="opc">foscili</span> .6, 400, 1, 11<span class="op">/</span>4, kindx, gisin
kpan1 <span class="opc">linseg</span> 0, 4, 1			<span class="comment">;panning for first sound</span>
kpan2 <span class="opc">linseg</span> 1, 4, 0			<span class="comment">;panning for second sound ...</span>
kpan2 <span class="opc">delayk</span> kpan2, 2			<span class="comment">;delayed by two seconds</span>
a1 <span class="op">=</span> asig <span class="op">*</span> kenv1
a2 <span class="op">=</span> asig <span class="op">*</span> kenv2

aL1,aR1 <span class="opc">pan2</span> a1, kpan1
aL2,aR2 <span class="opc">pan2</span> a2, kpan2
        <span class="opc">outs</span> aL1<span class="op">+</span>aL2, aR1<span class="op">+</span>aR2

<span class="oblock">endin</span>
<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="stamnt">i</span> 1 0 6
<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp98285344"></a>
        <h2>Credits</h2>
        <p>Istvan Varga.</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="delay1.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="delayr.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">delay1 </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> delayr</td>
        </tr>
      </table>
    </div>
  </body>
</html>
